<!DOCTYPE HTML>
<html>
<head>
    <title></title>
   	<meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
	<script type="text/javascript" charset="utf-8" src="js/jquery-1.8.0.min.js"></script>
	<link rel="stylesheet" type="text/css" charset="utf-8" href="css/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" charset="utf-8" href="css/oval-css/oval-icon.css">
	<link rel="stylesheet" type="text/css" charset="utf-8" href="css/themes/icon.css">
	<script type="text/javascript" charset="utf-8" src="js/jquery.easyui.min.js"></script>
	<script type="text/javascript" charset="utf-8" src="js/md5_encrypt.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/sfelib.js"></script>
    <script type="text/javascript">
	//http://localhost:8888/oval/mobileservlet?__methodName=loginJSON&pagename=about&actionname=default&__userName=Huazi&__password=13037799273f7f9a94b196501ef7fb0c&__orgCode=YILING&__IMEI=1&__phone=1
        $(function(){
            window.setTimeout(function(){ $('#name').focus();},0);
			$('#sfe_login_loginForm input').bind('keyup', function(event) {
				if (event.keyCode == '13') {
					sfe_login_login();
				}
		   });
        });
		
        function sfe_login_login(){
            var user_name = $('#name').val().replace(/\ /g,'');
            var user_pass = $('#password').val().replace(/\ /g,'');
            if(user_name != '' && user_name != null && user_pass != '' && user_pass != null){
			    user_pass = hex_md5(user_pass); 
                getLoginData(user_name,user_pass);
            }else{
                $.messager.show({
                    title:'提示',
                    msg:'请输入用户名或者密码',
                    timeout:3000,
                    showType:'slide'
                });
				return;
            }
        }

        function getLoginData(user_name,user_pass) {
            var variable = new Array('__methodName','__userName','__password','__IMEI','__phone','pagename','actionname','__orgCode','params');
            var value = new Array('loginJSON',user_name,user_pass,'1','1','p_sfelogin','login','YILING','');
            var dataStr = getJsonData(variable, value);			
            connectionServlet(dataStr, getLoginDataReturn);
        };
		
		function getLoginDataReturn(data){
		    if(data.successflag == 'false'){
			     $.messager.show({
                    title:'提示',
                    msg:'用户名或者密码错误，请重新输入!',
                    timeout:3000,
                    showType:'slide'
                });
				return;
			}
			if(typeof (data.result.userbaseinfo) != 'undefined'){
				 localStorage.setItem('employeename',data.result.userbaseinfo.employeename);
				 localStorage.setItem('oval_dictionary',JSON.stringify(data.result.dictionary));
				 localStorage.setItem('oval_product',JSON.stringify(data.result.product));
		    }else{
		         localStorage.setItem('employeename','default');
				 localStorage.setItem('oval_dictionary',JSON.stringify(data.result.dictionary));
				 localStorage.setItem('oval_product',JSON.stringify(data.result.product));
		    }
			localStorage.setItem('token',data.token);
			window.location.href="SFEHome.html";
		}
  </script>
</head>
<body class="easyui-layout" style="width:792px;height:492px;margin-left:auto;margin-right:auto;margin-top: 30px;background:#678fc2;">
<div data-options="region:'center',fit:true,border:false" >
    <div class="easyui-panel" style="background: url('images/loginbg.gif') no-repeat" data-options="fit:true,border:false">
       <!--  <div><img src="images/logo.jpg" style="width: 300px;height: 61px;margin-top: 8px;margin-left: 20px"></div> 
        <div  style="margin-top: 30px;margin-left: 20px"><span style="font-size: 30px">寰通SFE管理系统</span></div>-->
        <div style="margin-top: 160px;margin-left: 80px;">
		   <form id="sfe_login_loginForm" method="post">
				<table cellspacing="0px" cellpadding="6px">
					<tr>
						<th>用户名</th><td><input id="name" name="name" type="text" size="15" style="width:160px"></td>
					</tr>
					<tr>
					    <th>密&nbsp;&nbsp;码</th><td><input id="password" name="pass" type="password" size="15" style="width:160px"></td>
					</tr>
					<tr> 
					    <th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th><td align=right><a href="#" class="easyui-linkbutton"
											   onclick="sfe_login_login();">登录</a></td>
					</tr>
					<!--tr>
						<td>
						<iframe scrolling="yes" frameborder="0"  src="http://win-q7qoprtsaoj:8899/_layouts/15/OVAL.SFE.SharepointProject/TokenLogin.aspx?SFESystemToken=111111&userid=zhangsan&ReturnUrl=%2f" style="width:100%;height:100%;"></iframe></td>
					</tr-->
				</table>
			</form> 
        </div>
    </div>
</div>

</body>
</html>